using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Web;
using CTEM.Controllers.Global;
using CTEM.Models;
using CTEM.Controllers.DAO;

namespace CTEM.Controllers.BUS
{
    /// <summary>
    /// Business Logic layer of Role Entity
    /// </summary>
    public class RoleBUS
    {
        RoleDAO roleDAO = new RoleDAO();
        public List<RoleDTO> GetAll()
        {
            return roleDAO.GetAllRole();
        }

        public List<RoleDTO> GetRoleByMenuID(int menuID)
        {
            return roleDAO.GetRoleByMenuID(menuID);
        }
        public RoleDTO GetRoleByID(long roleID)
        {
            return roleDAO.GetRoleByID(roleID);
        }

        public List<RoleDTO> LoadAllRole()
        {
            return roleDAO.GetAllRole();
        }

        public bool DeleteRole(long RoleID)
        {
            return roleDAO.DeleteRole(RoleID);
        }

        public long AddRole(RoleDTO Role)
        {
            return roleDAO.CreateRole(Role.RoleName, Role.Description, Role.RightsValue, Role.IsActive);
        }

        public bool EditRole(RoleDTO Role)
        {
            return roleDAO.UpdateRole(Role.RoleID, Role.RoleName, Role.Description, Role.RightsValue, Role.IsActive);
        }

        public List<RoleDTO> GetWithoutAdmin()
        {
            return roleDAO.GetWithoutAdmin();
        }
    }
}
    